package test;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import org.hibernate.dialect.Oracle9iDialect;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import com.yatb.trac.dao.DAOService;

public class TEST {
	public static void main(String[] args) throws IOException {
		String sql = "select * from (SELECT   " + "t.* " + "FROM   "
				+ "tickets t " + "WHERE       " + "t.STATO_TICKET IN (1) AND "
				+ "t.ID_OWNER NOT IN ("
				+ "3"
				+ ")"
				+ "union "
				+ "SELECT   "
				+ "T.*  "
				+ "FROM   "
				+ "tickets t "
				+ "WHERE       "
				+ "(t.STATO_TICKET = 1 OR t.stato_ticket = 2) AND "
				+ "t.id_owner = "
				+ "3"
				+ " AND "
				+ "id_progetto IN ("
				+ "SELECT   "
				+ "p.id_progetto "
				+ "FROM "
				+ "progetti p, "
				+ "utente_progetto UP "
				+ "WHERE "
				+ "p.id_progetto = UP.id_progetto AND "
				+ "UP.id_utente = t.id_OWNER" + ") ) order by stato_ticket";
		Oracle9iDialect dialect = new Oracle9iDialect();
		System.out.println(dialect.getLimitString(sql, 0, 5));
	}
}
